package com.zryc.shop.oms.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zryc.shop.oms.entity.OrderReturnReason;
import com.zryc.shop.oms.mapper.OrderReturnReasonMapper;
import com.zryc.shop.oms.service.IOrderReturnReasonService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zryc.shop.ums.entity.Admin;
import com.zryc.shop.ums.entity.Menu;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 退货原因表 服务实现类
 * </p>
 *
 * @author zhaozhao
 * @since 2024-01-18
 */
@Service
public class OrderReturnReasonServiceImpl extends ServiceImpl<OrderReturnReasonMapper, OrderReturnReason> implements IOrderReturnReasonService {

    /**
     * 分页查询列表
     *
     * @param pageNum
     * @param pageSize
     * @return
     */
    @Override
    public Page<OrderReturnReason> list(Integer pageNum, Integer pageSize) {
        Page<OrderReturnReason> page = new Page<>(pageNum, pageSize);
        QueryWrapper<OrderReturnReason> wrapper = new QueryWrapper<>();
        return page(page, wrapper);
    }

    /**
     * 修改状态
     *
     * @param ids
     * @param status
     * @return
     */
    @Override
    public Object updateStatus(String ids, Integer status) {
        UpdateWrapper<OrderReturnReason> updateWrapper = new UpdateWrapper<>();
        updateWrapper.eq("id", ids);
        updateWrapper.set("status", status);
        update(updateWrapper);
        return null;
    }

    /**
     * 修改退货原因
     *
     * @param id
     * @param orderReturnReason
     * @return
     */
    @Override
    public Object detail(Long id, OrderReturnReason orderReturnReason) {
        UpdateWrapper<OrderReturnReason> updateWrapper = new UpdateWrapper<>();
        updateWrapper.eq("id",id);
        baseMapper.update(orderReturnReason,updateWrapper);
        return null;
    }
}
